public class Leet260 {
    public int[] singleNumber(int[] nums) {
        int temp = 0;
        for (int j : nums) temp ^= j;
        int le = 0;
        for (int i = 0; i < 32; i++) {
            if ((temp>>i&1)==1){
                le = i;
                break;
            }
        }
        int re0 = 0,re1 = 0;
        for (int num : nums) {
            if ((num >> le & 1) == 1) {
                re0 ^= num;
            } else re1 ^= num;
        }
        return new int[]{re0,re1};
    }
}
